package zuo.algo.c10;

/**
 * 00:57-打印一个字符串的全部子序列，包括空字符串
 */
public class PrintAllSubSquence {

    public static void exc1(String str) {
        char[] chars = str.toCharArray();
        process(chars, 0);
    }

    private static void process(char[] chars, int n) {
        if (n == chars.length) {
            print(chars);
            return;
        }
        process(chars, n + 1);
        char tmp = chars[n];
        chars[n] = 0;
        process(chars, n + 1);
        chars[n] = tmp;
    }

    private static void print(char[] chars) {
        System.out.println(String.valueOf(chars));
    }

    public static void main(String[] args) {
        exc1("abc");
    }
}
